import { getRolePages } from "@/api/roles";
import { reactive } from "vue";

//import type { Common,Role, QueryResult } from "@/api/roles";

//查询条件
export const queryCondition = reactive({
    name: '',
    size:5, 
})

//查询结果
export const queriedResult = ref({
    records: [],
    size: 0,
    total: 0,
})

//查询方法
export const queryRoles = async (params = {}) => {
   Object.assign(queryCondition,params)
   const {data} = await getRolePages(queryCondition)
   if( data.code === '000000' ){
      queriedResult.value = data.data
   } else{
    ElMessage.error('按条件查询角色信息失败')
   throw new Error('按条件查询角色信息失败')
   }
    
}